package org.ycx.doc.web.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
import org.springframework.security.web.authentication.RememberMeServices;
import org.springframework.security.web.session.HttpSessionEventPublisher;
import org.springframework.session.data.redis.RedisOperationsSessionRepository;
import org.springframework.session.security.web.authentication.SpringSessionRememberMeServices;

@Configuration
public class SpringSessionConfig {

    @Bean
    public HttpSessionEventPublisher httpSessionEventPublisher() {
        return new HttpSessionEventPublisher ();
    }

    @Bean
    RememberMeServices rememberMeServices() {
        SpringSessionRememberMeServices rememberMeServices =
                new SpringSessionRememberMeServices ();
        // optionally customize
        rememberMeServices.setAlwaysRemember (true);
        return rememberMeServices;
    }
}
